/*
 * @Author: your name
 * @Date: 2021-03-02 15:29:31
 * @LastEditTime: 2022-06-14 17:32:06
 * @LastEditors: liushengyan
 * @Description: In User Settings Edit1
 * @FilePath: \vue3-element-admin\src\plugins\mock.js
 */
import Mock from "mockjs";

export default {
  install: () => {
    if (import.meta.env.VITE_USE_MOCK) {
      const files = import.meta.globEager("./../api/**/*.js");
      Object.keys(files).forEach((key) => {
        let obj = files[key].default;
        Object.keys(obj).forEach((item) => {
          if (obj[item].mock) {
            Mock.mock(obj[item].url, obj[item].data);
          }
        });
      });
    }
  },
};
